import React from 'react';
import { Rate as AntdRate } from 'antd';
import type { RateProps as AntdRateProps } from 'antd';
import { createStyles } from 'antd-style';

export interface RateProps extends AntdRateProps {
  /**
   * @description 自定义样式类名
   */
  customClassName?: string;
}

const useStyles = createStyles(({ token, css }) => ({
  rate: css`
    color: ${token.colorWarning};
  `,
}));

const Rate: React.FC<RateProps> = ({ customClassName, className, ...restProps }) => {
  const { styles, cx } = useStyles();
  
  const rateClassName = cx(
    className,
    customClassName,
    styles.rate
  );

  return <AntdRate className={rateClassName} {...restProps} />;
};

export { Rate };
export default Rate;

